if exists (select name from sysobjects where name like 'Proc_NhanVien_Update')
	drop procedure Proc_NhanVien_Update
go

create PROC Proc_NhanVien_Update (@maNV int,@ten nvarchar(50),@cmnd int,@moTa nchar(10),
		@ngaySinh datetime, @diaChi nvarchar(50), @SoDT char(10) )
as
	if Exists (select maKH
				from KhachHang where @maNV= MaKH )
	set tran isolation level read committed
	begin tran
		Update NhanVien
		set TenNV= @ten,CMND = @cmnd, MoTa = @moTa, NgaySinh = @ngaySinh, DiaChi= @diaChi
			where MaNV =@maNV 
		return 1
	rollback
go

--------------------------------------------


if exists (select name from sysobjects where name like 'Proc_XemNhanVien')
	drop procedure Proc_XemNhanVien
go

create PROC Proc_XemNhanVien
as
set tran isolation level read committed
begin tran
select * from NhanVien
commit tran
go